<!doctype html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="css/personCenterNo.css"/>
		<link rel="stylesheet" type="text/css" href="css/app.css"/>
		<script src="js/mui.min.js"></script>
		<script type="text/javascript">
			mui.init()
		</script>
		<style type="text/css">
			.blockBtn{border: none; box-shadow: 2px 2px 2px #5763FF; background:#5763FF ;color: #FFFFFF;height: 45px;line-height: 0;width: 95%;margin: 50px auto 30px;display: block;}
			.blockBtn:active{background: #5763FF!important;}
			.mui-card{box-shadow: none;}
		</style>
	</head>

	<body>
		<div id="headerNav"></div>
		<div class="mui-content">
			<div class="mui-card cardPosition">
				<div class="mui-card-content">
					<div class="mui-card-content-inner">
						<a><img class="personImg" src="image/1ddadd4abbd793789eb0147dc57ae93c.jpg" /></a>
					</div>
					<div class="mui-input-row" style="width: 95%;margin: 0 auto;">
						<input type="text" placeholder="昵称" id="nameIpt" style="color: #333333;"/>
					</div>
				</div>
				<button type="submit" class="mui-btn blockBtn">保存</button>
			</div>
			
		</div>
		<nav class="mui-bar mui-bar-tab foot_nav">
			<!--<a class="mui-tab-item" id="indexHtml" href="index.html">
				<span class="mui-icon iconfont icon-iconfonthome0"></span>
				<span class="mui-tab-label">首页</span>
			</a>
			<a class="mui-tab-item" id="orderHtml" href="order_form.html">
				<span class="mui-icon iconfont icon-dingdan"></span>
				<span class="mui-tab-label">订单</span>
			</a>
			<a class="mui-tab-item mui-active" id="myHtml" href="register.html">
				<span class="mui-icon iconfont icon-weibiaoti-_huabanfuben"></span>
				<span class="mui-tab-label">我的</span>
			</a>-->
		</nav>
	</body>
	<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
	<script type="text/javascript">
		$('#headerNav').load('header.html',function(){
			$('header h1').html('个人资料');
		});
	var a = localStorage.state;
	var b = localStorage.data;
	if(a == 1){
		$.ajax({
			type: "post",
			url: "http://mall.itcn99.com/i/index/nav",
			dataType: "jsonp",
			async: true,
		//					jsonp: "callback",  //传递给请求处理程序或页面的，用以获得jsonp回调函数名的参数名,默认为callback
		//					jsonpCallback: "userHandler",  //自定义的jsonp回调函数名称，默认为jQuery自动生成的随机函数名，也可以写"?"，jQuery会自动为你处理数据
			data: {
		
			},
			success: function(data) {
					console.log(data);
				var nav_url = data.data[0]["nav_url"];
				var nav_url1 = data.data[1]["nav_url"];
				var nav_url2 = data.data[2]["nav_url"];
				console.log
				var title = data.data[0]["title"];
				var title1 = data.data[1]["title"];
				var title2 = data.data[2]["title"];
				$(".foot_nav").html("").append('<a class="mui-tab-item" id="indexHtml" href="'+nav_url+'.html"><span class="mui-icon iconfont icon-iconfonthome0"></span><span class="mui-tab-label">'+title+'</span></a><a class="mui-tab-item" id="orderHtml" href="'+nav_url1+'.html"><span class="mui-icon iconfont icon-dingdan"></span><span class="mui-tab-label">'+title1+'</span></a><a class="mui-tab-item mui-active" id="myHtml" href="'+nav_url2+'.html"><span class="mui-icon iconfont icon-weibiaoti-_huabanfuben"></span><span class="mui-tab-label">'+title2+'</span></a>')
			}
		})
		mui('.cardPosition').on('tap','.blockBtn',function(){
			var nameVal=$('#nameIpt').val();
			var nameImg=$('.personImg').attr('src');
			if(nameVal==''){
				mui.alert('','昵称不能为空')
			}else{
				$.ajax({
					type:"post",
					url:"http://mall.itcn99.com/i/index/edit_info",
					async:true,
					dataType:'jsonp',
					data:{
						'username':nameVal,
						'head_img':nameImg,
						'uid':b
					},
					success:function(data){
						if(data.state==1){
							mui.alert('','修改成功',function(){
								window.location.href='personCenter.html'
							})
						}else if(data.state==2){
							mui.alert('','网络超时',function(){
								return;
							})
						}else if(data.state==0){
							mui.alert('','无修改内容',function(){
								return;
							})
						}
					}
				});
			}
			
		})
	}else{
		//项目底部导航接口
		$.ajax({
			type: "post",
			url: "http://mall.itcn99.com/i/index/nav",
			dataType: "jsonp",
			async: true,
	//					jsonp: "callback",  //传递给请求处理程序或页面的，用以获得jsonp回调函数名的参数名,默认为callback
	//					jsonpCallback: "userHandler",  //自定义的jsonp回调函数名称，默认为jQuery自动生成的随机函数名，也可以写"?"，jQuery会自动为你处理数据
			data: {
			
			},
			success: function(data) {
					console.log(data);
				var nav_url = data.data[0]["nav_url"];
				var title = data.data[0]["title"];
				var title1 = data.data[1]["title"];
				var title2 = data.data[2]["title"];
				$(".foot_nav").html("").append('<a class="mui-tab-item mui-active" id="indexHtml" href="'+nav_url+'.html"><span class="mui-icon iconfont icon-iconfonthome0"></span><span class="mui-tab-label">'+title+'</span></a><a class="mui-tab-item" id="orderHtml" href="order_form.html"><span class="mui-icon iconfont icon-dingdan"></span><span class="mui-tab-label">'+title1+'</span></a><a class="mui-tab-item" id="myHtml" href="register.html"><span class="mui-icon iconfont icon-weibiaoti-_huabanfuben"></span><span class="mui-tab-label">'+title2+'</span></a>')
			}
		})
	}
		
		
		
	</script>
</html>